<template>
  <div class="Disconshelves">
    <div class="main">
      <div style="display:flex;">
        <div style="margin-left:20px;" class="list">
          <span style="margin-right:30px;" :class="list==index?'p':''" v-for="(item,index) in languagesarr" :key="index" @click="getlist(index)">{{item}}</span>
        </div>
        <div class="div">
          <div class="div1" :class="list1==true?'p':''" @click="getlist1">
            <span>推荐</span>
          </div>
          <div class="div2" :class="list1==false?'p':''" @click="getlist1">
            <span>全部</span>
          </div>
        </div>
      </div>
      <div class="imglist">
        <div style="" v-for="item in monthData" :key="item.id">
          <img :src="item.blurPicUrl" alt="#">
          <p>{{item.name}}</p>
          <span>{{item.artist.name}}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: 'Disconshelves',
  data() {
    return {
      languagesarr: ['全部', '华语', '欧美', '韩国', '日本'],
      list: 0,
      list1: true,
      area: 'ALL',
      limit: 30
    }
  },
  computed: {
    ...mapState({
      monthData: state => state.Latestmusic.monthData
    })
  },
  methods: {
    getlist(e) {
      this.list = e
      if (e == 0) {
        this.area = 'ALL'
        this.$store.dispatch('getXindieshangjiaList', { area: this.area })
      } else if (e == 1) {
        this.area = 'ZH'
        this.$store.dispatch('getXindieshangjiaList', { area: this.area })
      } else if (e == 2) {
        this.area = 'EA'
        this.$store.dispatch('getXindieshangjiaList', { area: this.area })
      } else if (e == 3) {
        this.area = 'KR'
        this.$store.dispatch('getXindieshangjiaList', { area: this.area })
      } else if (e == 4) {
        this.area = 'JP'
        this.$store.dispatch('getXindieshangjiaList', { area: this.area })
      }
    },
    getlist1() {
      this.list1 = !this.list1
      if (this.list1 == false) {
        this.$store.dispatch('getAllnewdiscsList', { limit: this.limit, area: this.area })
      } else {
        this.$store.dispatch('getXindieshangjiaList', { area: this.area })
      }
    }
  },
  mounted() {
    this.$store.dispatch('getXindieshangjiaList', { area: this.area })
  }
}
</script>

<style lang="less" scoped>
.Disconshelves {
  .main {
    margin-top: 20px;
    .list {
      span {
        font-size: 14px;
        opacity: 0.6;
      }
      span:hover {
        cursor: pointer;
        opacity: 1;
      }
      .p {
        font-size: 15px;
        opacity: 1;
        font-weight: bold;
      }
    }
    .div {
      margin-left: 650px;
      display: flex;
      .div1 {
        padding: 3px 10px;

        font-size: 11px;
        margin-right: 30px;
        border-radius: 20px;
      }
      .div2 {
        padding: 3px 10px;
        font-size: 12px;
        border-radius: 20px;
      }
      .p {
        background-color: antiquewhite;
        color: red;
      }
      .div1:hover {
        background-color: rgb(239, 238, 236);
        cursor: pointer;
      }
      .div2:hover {
        background-color: rgb(239, 238, 236);
        cursor: pointer;
      }
    }
    .imglist {
      margin-top: 30px;
      display: flex;
      display: grid;
      width: 1100px;
      grid-template-columns: auto auto auto auto auto;
      img {
        width: 170px;
        height: 170px;
        border-radius: 5px;
      }
      img:hover {
        cursor: pointer;
      }
      p {
        opacity: 0.8;
        font-size: 14px;
        width: 170px;
        word-wrap: break-word;
      }
      p:hover {
        opacity: 1;
        cursor: pointer;
      }
      span {
        font-size: 12px;
        opacity: 0.6;
        margin-top: 10px;
        width: 170px;
        word-wrap: break-word;
        display: inline-block;
      }
      span:hover {
        opacity: 1;
        cursor: pointer;
      }
    }
  }
}
</style>